package cj.com.chabaike.bll;

/**
 * Created by CJLAB on 2015/8/10.
 * 该类用于管理熊猫新闻的api
 */
public class PandaPagerManager {


    private String HomePagerRawUrl = "http://mvod.sctv.com:60080/api/redesign.php?action=get_redesignHome&com_num=5&elite_num=10&page=";
    static public int HomePagerCurrentpager = 2;
    String detailPartUrl = "http://mvod.sctv.com:60080/index.php?option=share,viewnews&id=";

    /**
     * *********************************************
     */
    private String news = "http://mvod.sctv.com:60080/api/wireless.php?action=get_ContentList&sid=";
    String[] newsId = {"317", "318", "495", "344", "623", "345", "341"};
                   //新闻天下   奇趣   体娱  健康美食 功夫厨房  健康  旅游
    static public int[] newsCurrenPager = {2, 2, 2, 2, 2, 2, 2};
    private String newsPagerPart = "&recommend=true&com_num=5&page=";
    private String newsLastPart = "&per_page=10";

    /**
     * ******************搜索接口*******************************
     */
    String seach = "http://mvod.sctv.com:60080/api/wireless.php?action=get_searchlist&word=";
    String seachLast = "&page=1&per_page=10";

    /**
     * ***********************专题接口*************************************
     */
    String special = "http://mvod.sctv.com:60080/api/wireless.php?action=get_SpecialList&recommend=5&com_num=3&page=";
    String specialLast = "&per_page=10";

    String sepcialDetail = "http://mvod.sctv.com:60080/api/wireless.php?action=get_Special&id=";



    public  static  int special_CurrentPager = 2;

    static private PandaPagerManager pandaPagerManager;

    public static PandaPagerManager getPandaPagerManagerInstance() {
        if (pandaPagerManager == null) {
            pandaPagerManager = new PandaPagerManager();
        }
        return pandaPagerManager;
    }

    public String getHomePgerFirstPager() { //获取首页第一页数据 ，用于下拉刷新
        return HomePagerRawUrl + "1";
    }

    public String getHomePgerNextPager() {//获取首页的下一页数据 ，当前页由数据接入层是否成功获取上一页数据决定
        return HomePagerRawUrl + HomePagerCurrentpager;
    }

    public String getDetailUrl(String id) {
        return detailPartUrl + id + "&vidindex=0";
    }

    public String getNewsTypeUrl_FirstPager(int type) {
        return news + newsId[type] + newsPagerPart + 1 + newsLastPart;
    }

    public String getNewsTypeUrl_NextPager(int type) {
        return news + newsId[type] + newsPagerPart + newsCurrenPager[type] + newsLastPart;

    }

    public String getSeachUrl(String keyWork) {
        return seach + keyWork + seachLast;
    }

    public String getSpecialFirstPager() { //
        return special + "1"+specialLast;
    }


    public String getSpecialNextPager() {//
        return special + special_CurrentPager+specialLast;
    }

    public String getSpecialDetailUrl(String ID){
        return  sepcialDetail+ID;
    }
}